<template>

  <el-container :style="'height:' + height">
    <el-aside width="auto">
      <div class="menu-title">
        <i class="el-icon-platform-eleme menu-title-logo"></i>
        <span v-show="!isCollapse" class="menu-title-word">后台管理系统</span>
      </div>
      <el-menu
        default-active="1"
        class="el-menu-vertical-demo"
        @open="handleOpen"
        @close="handleClose"
        :collapse="isCollapse"
        :router=true
        background-color="#304156"
        text-color="#bfcbd9"
        active-text-color="#001528">
        <el-submenu index="1">
          <template slot="title"><i class="el-icon-setting"/><span>系统管理</span></template>
          <el-menu-item-group>
            <el-menu-item index="/system/user">用户管理</el-menu-item>
            <el-menu-item index="/system/dept">部门管理</el-menu-item>
            <el-menu-item index="/system/empinfo">员工管理</el-menu-item>
            <el-menu-item index="/system/role">角色管理</el-menu-item>
            <el-menu-item index="/system/dict">字典管理</el-menu-item>
            <el-menu-item index="/system/dict">日志管理</el-menu-item>
            <el-submenu index="1-4">
              <template slot="title">日志管理</template>
              <el-menu-item index="/system/log/operlog">操作日志</el-menu-item>
              <el-menu-item index="/system/log/logininfor">登录日志</el-menu-item>
            </el-submenu>
          </el-menu-item-group>
        </el-submenu>
        <el-submenu index="2">
          <template slot="title"><i class="el-icon-menu"/><span>业务管理</span></template>
          <el-menu-item-group>
            <el-menu-item index="/work/area">景区管理</el-menu-item>
            <el-menu-item index="/work/spot">景点管理</el-menu-item>
            <el-menu-item index="/work/order">订单管理</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
        <el-submenu index="3">
          <template slot="title"><i class="el-icon-menu"/><span>系统监控</span></template>
          <el-menu-item-group>
            <el-menu-item index="/monitor/log">系统日志</el-menu-item>
            <el-menu-item index="/monitor/echarts">系统报表</el-menu-item>
            <el-menu-item index="/monitor/server">服务监控</el-menu-item>
            <el-menu-item index="/monitor/druid">druid监控</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
      </el-menu>
    </el-aside>
    <el-container>
      <el-header style=" font-size: 16px; height: 50px">
        <el-col :span="2">
          <el-radio-group v-model="isCollapse" size="small">
            <el-radio-button :label="false">展开</el-radio-button>
            <el-radio-button :label="true">收起</el-radio-button>
          </el-radio-group>
        </el-col>
        <el-col :span="8" style="margin-left:-15px ">
          <el-breadcrumb separator="/">
            <el-breadcrumb-item :to="{ path: '/main' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item :to="{ path: url,name }">{{ name }}</el-breadcrumb-item>
          </el-breadcrumb>
        </el-col>
        <el-col :span="4" style="text-align: end">
          <span>{{ userName }}</span>
          <el-dropdown style="line-height: 20px;text-align:center;">
            <i class="el-icon-setting" style="margin-right: 15px"></i>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>个人中心</el-dropdown-item>
              <el-dropdown-item>个人设置</el-dropdown-item>
              <el-dropdown-item>退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-col>
      </el-header>
      <el-main style="overflow: hidden">
        <router-view/>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data() {
    return {
      // 菜单栏的折叠展开控制
      isCollapse: false,
      userName: this.$route.query.userName,
      //高度
      height: document.documentElement.clientHeight + "px;",
      name: this.$route.name,
      url: this.$route.path

    };
  },
  created() {

  },
  watch: {
    'url': {
      handler(newval, old) {
        console.log(newval);
      }
    }
  },
  methods: {
    handleOpen(key, keyPath) {
      //console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      //console.log(key, keyPath);
    }
  },

};
</script>
<style scoped>
.el-aside {
  background-color: #304156;
}

.menu-title {
  height: 50px
}

.menu-title-logo {
  vertical-align: middle;
  text-align: center;
  font-size: 24px;
  color: #fff;
  margin: 13px 0 13px 22px;
}

.menu-title-word {
  display: inline-block;
  margin-right: 14px;
  color: #fff;
  font-weight: 600;
  line-height: 50px;
  font-size: 14px;
  font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
  vertical-align: middle;
}

.el-header, .el-footer {
  text-align: left;
  line-height: 50px;
}

.el-main {
  color: #333;
  line-height: 40px;
}

.el-menu-item, .el-submenu__title {
  height: 48px;
  line-height: 48px;
}
</style>

